<?php

/*

  Action	$3

  +2 Actions
  Reveal your hand.
  If you have no Action cards in hand, +2 Cards.

 */

class ShantyTown extends Card implements iAction, iKingdom, iIntrigue {

    public function __construct() {
        parent::__construct("Shanty Town", 3);
        $this->undoPlay = false;
        $this->undoBuy = true;
    }

    public function getDescription() {
        return array(
            "+2 Actions",
            "",
            "Reveal your hand.  If you have no Action cards in hand, +2 Cards.");
    }
    
    public function play(Game $game, $isRealCard) {
        $game->addActions(2);
        
        $playHand = $game->getPlayHand();
         ScreenDisplay::addScreenMessage($game, true, "get +2 actions and reveal ". nicePrint($playHand), "gets +2 actions and reveals ".ScreenDisplay::$LMSG);
        
        $actions_found = false;
        foreach ($playHand as $card) {
            if ($card instanceof iAction) {
                $actions_found = true;
                break;
            }
        }

        if (!$actions_found) {
            $drawed_cards =$game->drawCards(2);
             ScreenDisplay::addScreenMessage($game, true, "draw ".nicePrint($drawed_cards), "draws ".sizeof($drawed_cards)." cards");
        }
		$game->cardActionFinished();
        return true;
    }

}

?>